package com.kedi.healthcenter.controller;

import java.util.List;
import java.util.Map;

import com.kedi.healthcenter.enums.ResultEnum;
import com.kedi.healthcenter.exception.CommonException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.kedi.healthcenter.service.OtherSourceService;

/**
 * 
 *
 * @ClassName OtherSourceController
 * @author: 陈辽逊
 * @date: 2019/7/13 12:41
 */
@Controller
public class OtherSourceController {

	@Autowired
	public OtherSourceService service;

    private static Logger logger = LoggerFactory.getLogger(OtherSourceController.class);







	 /**
	  * @Description:肿瘤基因的详情介绍
	  * @return
	  */
    @RequestMapping("/selectothersource")
    @ResponseBody
    public List<Map<String, Object>> selectothersource() {
    	List<Map<String,Object>> users = service.othersource();
        return users;
    }
    /**
     * @Description:肿瘤基因的预约情况查询
     * @return
     */
    @RequestMapping("/subscribe")
    @ResponseBody
    public List<Map<String, Object>> showSubscribe() {
    	return service.showSubscribe();
    }

    /**
     * 方法实现说明 获取康复预约详情
     * @author      ytw
     *@param
     * @return
     * @exception
     * @date        2019/8/2 14:09
     */
    @RequestMapping("/recoveryDetail")
    @ResponseBody
    public List<Map<String, Object>> recoveryDetail(){

        List<Map<String, Object>> list = service.recoveryDetail();
        if(list.isEmpty()){
            logger.info("康复预约详情为空");
            throw new CommonException(ResultEnum.LIST_NOT_EXISTED);
        }else{
            return list;
        }
    }

    /**
    * 方法实现说明  免费体检详情
    * @author      ytw
    *@param
    * @return
    * @exception
    * @date        2019/8/2 20:32
    */
    @RequestMapping("/freemedicalDetail")
    @ResponseBody
    public List<Map<String, Object>> freemedical(){

        List<Map<String, Object>> list = service.freemedical();
        if(list.isEmpty()){
            logger.info("康复预约详情为空");
            throw new CommonException(ResultEnum.LIST_NOT_EXISTED);
        }else{
            return list;
        }
    }

}
